Assertion Roulette
^^^^^
**Definition:**
* Occurs when a test method has multiple non-documented assertions. Multiple assertion statements in a test method without a descriptive message impacts readability/understandability/maintainability as it’s not possible to understand the reason for the failure of the test.
.. code-block:: python
import unittest
airLinesCode = ['2569','2450','2340']
class Flight:
def __init__(self,airLine,mileage):
self.mileage = mileage
self.airLine = airLine
self.fullFuel = True
def isValidAirLineCode(self):
for airLineCode in airLinesCode:
if(self.airLine == airLineCode):
return True
return False
class TestFlight(unittest.TestCase):
def test_flight(self):
flight = Flight('2569',1000)
self.assertEqual(flight.mileage,1000)
self.assertTrue(flight.fullFuel)
self.assertTrue(flight.isValidAirLineCode())
if __name__ == '__main__':
unittest.main(argv=['first-arg-is-ignored'], exit=False)
**References:**
.. admonition:: Quality attributes
* :octicon:`file-code;1em` - Code Example
* :octicon:`comment-discussion;1em` - Cause and Effect
* :octicon:`graph;1em` - Frequency
* :octicon:`sync;1em` - Refactoring
* `A preliminary evaluation on the relationship among architectural and test smells `_
* `A survey on test practitioners' awareness of test smells `_
* `An Empirical Study into the Relationship Between Class Features and Test Smells `_ :octicon:`graph;1em`
* `An Exploratory Study on the Refactoring of Unit Test Files in Android Applications `_ :octicon:`comment-discussion;1em` :octicon:`sync;1em`
* `An empirical analysis of the distribution of unit test smells and their impact on software maintenance `_ :octicon:`graph;1em`
* `An empirical investigation into the nature of test smells `_ :octicon:`sync;1em`
* `An exploratory study of the relationship between software test smells and fault-proneness `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em`
* `Analyzing Test Smells Refactoring from a Developers Perspective `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em` :octicon:`sync;1em`
* `Are test smells really harmful? An empirical study `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em` :octicon:`sync;1em`
* `As Code Testing: Characterizing Test Quality in Open Source Ansible Development `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em`
* `Assessing diffusion and perception of test smells in scala projects `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`graph;1em` :octicon:`sync;1em`
* `Automatic Identification of High-Impact Bug Report by Product and Test Code Quality `_
* `Automatic generation of smell-free unit tests `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em`
* `Categorising Test Smells `_ :octicon:`graph;1em`
* `Characterizing High-Quality Test Methods: A First Empirical Study `_ :octicon:`graph;1em`
* `Detection of test smells with basic language analysis methods and its evaluation `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em`
* `Developers perception on the severity of test smells: an empirical study `_ :octicon:`graph;1em` :octicon:`sync;1em`
* `Did You Remember To Test Your Tokens? `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em`
* `Do the Test Smells Assertion Roulette and Eager Test Impact Students' Troubleshooting and Debugging Capabilities? `_ :octicon:`comment-discussion;1em`
* `Enhancing developers’ awareness on test suites’ quality with test smell summaries `_
* `Generated Tests in the Context of Maintenance Tasks: A Series of Empirical Studies `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`graph;1em` :octicon:`sync;1em`
* `Handling Test Smells in Python: Results from a Mixed-Method Study `_
* `How are test smells treated in the wild? A tale of two empirical studies `_ :octicon:`graph;1em`
* `Improving Student Testing Practices through a Lightweight Checklist Intervention. `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`graph;1em`
* `Inspecting Automated Test Code: A Preliminary Study `_ :octicon:`graph;1em`
* `Investigating Severity Thresholds for Test Smells `_ :octicon:`comment-discussion;1em`
* `Investigating Test Smells in JavaScript Test Code `_ :octicon:`graph;1em`
* `Is Assertion Roulette still a test smell? An experiment from the perspective of testing education `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`graph;1em` :octicon:`sync;1em`
* `On the Distribution of "Simple Stupid Bugs" in Unit Test Files: An Exploratory Study `_
* `On the Relation of Test Smells to Software Code Quality `_
* `On the diffusion of test smells and their relationship with test code quality of Java projects `_ :octicon:`graph;1em`
* `On the diffusion of test smells in automatically generated test code: an empirical study `_
* `On the distribution of test smells in open source Android applications: an exploratory study `_ :octicon:`graph;1em`
* `On the influence of Test Smells on Test Coverage `_
* `On the interplay between software testing and evolution and its effect on program comprehension `_ :octicon:`comment-discussion;1em`
* `On the test smells detection: an empirical study on the jnose test accuracy `_ :octicon:`graph;1em`
* `On the use of test smells for prediction of flaky tests `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em`
* `Pizza versus Pinsa: On the Perception and Measurability of Unit Test Code Quality `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em`
* `Practitioner Perceptions of Ansible Test Smells `_ :octicon:`comment-discussion;1em`
* `PyNose: A Test Smell Detector For Python `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em`
* `Pytest-Smell: a smell detection tool for Python unit tests `_ :octicon:`graph;1em`
* `Quality defects detection in unit tests `_ :octicon:`comment-discussion;1em`
* `RAIDE: a tool for Assertion Roulette and Duplicate Assert identification and refactoring `_ :octicon:`comment-discussion;1em` :octicon:`sync;1em`
* `Refactoring Test Code `_ :octicon:`comment-discussion;1em` :octicon:`sync;1em`
* `Refactoring Test Smells With JUnit 5: Why Should Developers Keep Up-to-Date? `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`graph;1em` :octicon:`sync;1em`
* `Refactoring Test Smells: A Perspective from Open-Source Developers `_ :octicon:`file-code;1em` :octicon:`sync;1em`
* `Revisiting Test Smells in Automatically Generated Tests: Limitations, Pitfalls, and Opportunities `_ :octicon:`file-code;1em` :octicon:`graph;1em`
* `Scented since the beginning: On the diffuseness of test smells in automatically generated test code `_
* `Smart prediction for refactorings in the software test code `_ :octicon:`graph;1em`
* `SoCRATES: Scala radar for test smells `_
* `Software Unit Test Smells `_ :octicon:`file-code;1em`
* `Test Artifacts — The Practical Testing Book `_ :octicon:`file-code;1em` :octicon:`sync;1em`
* `Test Smell Detection Tools: A Systematic Mapping Study `_
* `Test-related factors and post-release defects: an empirical study `_
* `TestAXE: Automatically Refactoring Test Smells Using JUnit 5 Features `_ :octicon:`graph;1em` :octicon:`sync;1em`
* `TestQ: Exploring Structural and Maintenance Characteristics of Unit Test Suites `_
* `The Relation of Test-Related Factors to Software Quality: A Case Study on Apache Systems `_ :octicon:`graph;1em`
* `The secret life of test smells-an empirical study on test smell evolution and maintenance `_ :octicon:`graph;1em`
* `To What Extent Can Code Quality be Improved by Eliminating Test Smells? `_ :octicon:`comment-discussion;1em`
* `Toward static test flakiness prediction: a feasibility study `_
* `Towards Automated Tools for Detecting Test Smells: An Empirical Investigation into the Nature of Test Smells `_ :octicon:`comment-discussion;1em` :octicon:`graph;1em`
* `Understanding Testability and Test Smells `_
* `Understanding practitioners’ strategies to handle test smells: a multi-method study `_ :octicon:`comment-discussion;1em` :octicon:`sync;1em`
* `Unit Test Smells and Accuracy of Software Engineering Student Test Suites `_
* `What We Know About Smells in Software Test Code `_
* `What the Smell? An Empirical Investigation on the Distribution and Severity of Test Smells in Open Source Android Applications `_ :octicon:`graph;1em`
* `Why do builds fail?—A conceptual replication study `_
* `tsDetect: an open source test smells detection tool `_
* `xUnit test patterns: Refactoring test code `_ :octicon:`comment-discussion;1em` :octicon:`sync;1em`